package com.archives.blog.common.exp;

import com.archives.blog.common.enums.ErrorCodeEnum;

public class BlogException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private final ErrorCodeEnum errorCode;
	
	private final String message;
	
	public BlogException(ErrorCodeEnum errorCode){
		super(errorCode.getErrorMsg());
		this.errorCode = errorCode;
		this.message = errorCode.getErrorMsg();
	}
	
	public BlogException(ErrorCodeEnum errorCode, String message){
		super(message);
		this.errorCode = errorCode;
		this.message = message;
	}
	
	public BlogException(ErrorCodeEnum errorCode, String message, Throwable exp){
		super(message, exp);
		this.errorCode = errorCode;
		this.message = message;
	}
	
	public BlogException(ErrorCodeEnum errorCode, Throwable exp){
		super(errorCode.getErrorMsg(), exp);
		this.errorCode = errorCode;
		this.message = errorCode.getErrorMsg();
	}

	/**
	 * @return the errorCode
	 */
	public ErrorCodeEnum getErrorCode() {
		return errorCode;
	}

	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}

}
